home *** CD-ROM | disk | FTP | other *** search
- unit DemoPack;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, Grids, StdCtrls, Buttons, ExtCtrls, TabNotBk
- , UserInfo
- , UserNetw
- , UserBDE
- , UserWin
- , Splash
- , Bitbox
- , Resizer
- , Shells
- , Restorer
- , Debugctl
- , ErrorMsg
- , OkCore
- , Working
- , LoginDlg
- , IniLink
- , Toolbar
- , Invoice
- , About
- , ToolProc
- , DocProps;
-
- type
- TtPack2Form = class(TForm)
- TabbedNotebook1: TTabbedNotebook;
- WindowsGrid: TStringGrid;
- NovellGrid: TStringGrid;
- BDEGrid: TStringGrid;
- Memo1: TMemo;
- Button1: TButton;
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Edit1: TEdit;
- Label4: TLabel;
- Button2: TButton;
- Panel1: TPanel;
- SpeedButton1: TSpeedButton;
- Edit2: TEdit;
- Label5: TLabel;
- Label6: TLabel;
- Edit3: TEdit;
- Button3: TButton;
- Label7: TLabel;
- Edit4: TEdit;
- Button4: TButton;
- Label8: TLabel;
- StatusBar2: TStatusBar;
- MessagePanel1: TMessagePanel;
- StatusPanel1: TStatusPanel;
- WindowsUserInfo1: TWindowsUserInfo;
- NetWareUserInfo1: TNetWareUserInfo;
- BDEUserInfo1: TBDEUserInfo;
- SplashScreen1: TSplashScreen;
- IniFileLink1: TIniFileLink;
- Button5: TButton;
- LoginDialog1: TLoginDialog;
- Button6: TButton;
- WorkingMsg1: TWorkingMsg;
- Button7: TButton;
- ErrorDialog1: TErrorDialog;
- Button8: TButton;
- DebugControl1: TDebugControl;
- FormRestorer1: TFormRestorer;
- ReSizerPanel1: TReSizerPanel;
- Memo2: TMemo;
- Memo3: TMemo;
- ReSizerPanel2: TReSizerPanel;
- Label11: TLabel;
- BitBox1: TBitBox;
- Button10: TButton;
- Invoice1: TInvoice;
- AboutBox1: TAboutBox;
- Button9: TButton;
- Edit5: TEdit;
- Label12: TLabel;
- Label13: TLabel;
- Edit6: TEdit;
- Label14: TLabel;
- RadioGroup1: TRadioGroup;
- Button11: TButton;
- PropertyViewer1: TPropertyViewer;
- Label15: TLabel;
- CheckBox1: TCheckBox;
- procedure FormCreate(Sender: TObject);
- procedure Edit1Change(Sender: TObject);
- procedure SpeedButton1Click(Sender: TObject);
- procedure BitBox1Change(Sender: TObject);
- procedure Button1Click(Sender: TObject);
- procedure Button2Click(Sender: TObject);
- procedure Button3Click(Sender: TObject);
- procedure Button4Click(Sender: TObject);
- procedure Button5Click(Sender: TObject);
- procedure Button6Click(Sender: TObject);
- procedure Button7Click(Sender: TObject);
- procedure Button8Click(Sender: TObject);
- procedure Button10Click(Sender: TObject);
- procedure Button9Click(Sender: TObject);
- procedure RadioGroup1Click(Sender: TObject);
- procedure Button11Click(Sender: TObject);
- procedure CheckBox1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- const
- BoolString: array[False..True] of string[5] = ('FALSE','TRUE');
-
- var
- tPack2Form: TtPack2Form;
-
- implementation
-
- {$R *.DFM}
-
- {-----------------------------------------------------------------------------------------}
- { FORM CODE }
- {-----------------------------------------------------------------------------------------}
-
- procedure TtPack2Form.FormCreate(Sender: TObject);
- begin
- TabbedNoteBook1.PageIndex:= 0;
- CheckBox1.Checked:= DebugControl1.Enabled;
-
- with NovellGrid do begin
- ColCount:=2;
- ColWidths[0]:=120;
- ColWidths[1]:=200;
- Width:=320+GridLineWidth;
- RowCount:=1+6;
- Height:=RowCount*(DefaultRowHeight+GridLineWidth)+GridLineWidth;
- cells[0,0]:='Property';
- cells[1,0]:='Value';
-
- cells[0,1]:='ConnectID';
- cells[0,2]:='ConnectNumber';
- cells[0,3]:='ServerName';
- cells[0,4]:='LoginName';
- cells[0,5]:='FullName';
- cells[0,6]:='LoginTime';
-
- with NetWareUserInfo1 do begin
- cells[1,1]:=inttostr(ConnectID);
- cells[1,2]:=inttostr(ConnectNumber);
- cells[1,3]:=ServerName;
- cells[1,4]:=LoginName;
- cells[1,5]:=FullName;
- cells[1,6]:=LoginTime +' (FORMAT??)';
- end;
- end;
-
- with WindowsGrid do begin
- ColCount:=2;
- ColWidths[0]:=120;
- ColWidths[1]:=200;
- Width:=320+GridLineWidth;
- RowCount:=1+4;
- Height:=RowCount*(DefaultRowHeight+GridLineWidth)+GridLineWidth;
- cells[0,0]:='Property';
- cells[1,0]:='Value';
- cells[0,1]:='LoginName';
- cells[0,2]:='CompanyName';
- cells[0,3]:='WindowsPath';
- cells[0,4]:='SaverDelay';
-
- with WindowsUserInfo1 do begin
- cells[1,1]:=UserName;
- cells[1,2]:=CompanyName;
- cells[1,3]:=WindowsPath;
- cells[1,4]:=inttostr(SaverDelay);
- end;
- end;
-
- with BDEGrid do begin
- ColCount:=2;
- ColWidths[0]:=120;
- ColWidths[1]:=200;
- Width:=320+GridLineWidth;
- RowCount:=1+6;
- Height:=RowCount*(DefaultRowHeight+GridLineWidth)+GridLineWidth;
- cells[0,0]:='Property';
- cells[1,0]:='Value';
- cells[0,1]:='UserName';
- cells[0,2]:='NetType';
- cells[0,3]:='NetProtocol';
- cells[0,4]:='NetShare';
- cells[0,5]:='LocalShare';
- cells[0,6]:='IniFile';
- cells[0,7]:='LangDriver';
-
- with BDEUserInfo1 do begin
- cells[1,1]:=UserName;
- cells[1,2]:=NetType;
- cells[1,3]:=inttostr(NetProtocol);
- cells[1,4]:=BoolString[NetShare];
- cells[1,5]:=BoolString[LocalShare];
- cells[1,6]:=IniFile;
- cells[1,7]:=LangDriver;
- end;
- end;
-
- Edit1.Text:=inttostr(BitBox1.Numeric);
-
- Edit2.Text:=Application.Title;
- Edit3.Text:='Caption';
- Edit4.Text:=Caption;
- Button3.Click; {to save}
-
- end;
-
-
- procedure TtPack2Form.SpeedButton1Click(Sender: TObject);
- begin
- Close;
- end;
-
- procedure TtPack2Form.BitBox1Change(Sender: TObject);
- begin
- Edit1.Text:=inttostr(BitBox1.Numeric);
- end;
-
- procedure TtPack2Form.Edit1Change(Sender: TObject);
- begin
- BitBox1.Numeric:=StrToIntDef(Edit1.Text,0);
- end;
-
-
- procedure TtPack2Form.Button1Click(Sender: TObject);
- begin
- Splashscreen1.Execute; {uses (customizable) component residing on form}
- end;
-
- procedure TtPack2Form.Button2Click(Sender: TObject);
- begin
- with TSplashScreen.Create(self) do
- free; {instantiates and releases form loader}
- end;
-
- procedure TtPack2Form.Button3Click(Sender: TObject);
- begin
- with IniFileLink1 do begin {name/path blank by default point to exe dir/name}
- Section:=Edit2.Text;
- Entry:=Edit3.Text;
- StringValue:=Edit4.Text; {this writes it as a string}
- end;
- end;
-
- procedure TtPack2Form.Button4Click(Sender: TObject);
- begin
- with IniFileLink1 do begin {name/path blank by default point to exe dir/name}
- Section:=Edit2.Text; {you don't have to do this usually. this is a demo}
- Entry:=Edit3.Text;
- Edit4.Text:=StringValue; {this reads it as a string}
- end;
- end;
-
- procedure TtPack2Form.Button5Click(Sender: TObject);
- begin
- AboutBox; {uses code in toolproc to run about box.
- consider moving the code below into there as well.}
- end;
-
- procedure TtPack2Form.Button6Click(Sender: TObject);
- begin
- with LoginDialog1 do begin
- Execute;
- if not PassWordOk then
- raise Exception.Create('PASSWORD NOT SUPPLIED.. TRY ''TPACK''');
- end;
-
- end;
-
- procedure TtPack2Form.Button7Click(Sender: TObject);
- const
- i:longint=0;
- begin
- WorkingMsg1.Execute;
- while WorkingMsg1.Active do begin
- inc(i);
- Application.Hint:='Sample Process running; '+inttostr(i);
- Application.OnHint(Sender);
- end;
- end;
-
- procedure TtPack2Form.Button8Click(Sender: TObject);
- begin
- ErrorDialog1.Test:=true;
- end;
-
- procedure TtPack2Form.Button10Click(Sender: TObject);
- begin
- Invoice1.Execute;
- end;
-
- procedure TtPack2Form.Button9Click(Sender: TObject);
- begin
- PropertyViewer1.Persistent:=tPack2Form;
- PropertyViewer1.Execute;
- end;
-
- procedure TtPack2Form.RadioGroup1Click(Sender: TObject);
- begin
- with TRadioGroup(Sender) do
- case ItemIndex of
- -1: exit;
- 0: begin
- Edit5.Text:='dir';
- Edit6.Text:='/p';
- end;
- 1: begin
- Edit5.Text:='notepad';
- Edit6.Text:='!readme';
- end;
- 2: begin
- Edit5.Text:='tpDll';
- Edit6.Text:='AboutBox';
- end;
- end;
- end;
-
- procedure TtPack2Form.Button11Click(Sender: TObject);
- var
- s:TGenericShell;
- begin
- with RadioGroup1 do
- case ItemIndex of
- -1: exit;
- 0: s:=TDosShell.Create(Owner);
- 1: s:=TWindowsShell.Create(Owner);
- 2: s:=TDLLShell.Create(Owner);
- end;
- with s do try
- Flags:=Flags+[shlMsgTillReady];
- run(edit5.Text,edit6.Text);
- finally
- free;
- end;
- end;
-
- procedure TtPack2Form.CheckBox1Click(Sender: TObject);
- begin
- DebugControl1.Enabled:= CheckBox1.Checked;
- end;
-
- end.
-